//房间相关接口的管理
import $http from '@/service/request.js'


//新增房间
//接口：/rooms/add
//POST
export const _addrooms = ({account_user,name_room,id_lab}) =>{
	return $http.request({
		url:'/rooms/add',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user,
			name_room,
			id_lab
		}
	})
}

//删除房间
//接口：/rooms/delete
//DELETE
export const _deleterooms = (serialnum_room) =>{
	return $http.request({
		url:'/rooms/delete',
		method:'DELETE',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			serialnum_room
		},
	})
}

//修改房间信息（名称）
//接口：/rooms/modify
//PUT
export const _modifyrooms = ({serialnum_room,name_room}) =>{
	return $http.request({
		url:'/rooms/modify',
		method:'PUT',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			serialnum_room,
			name_room
		}
	})
}

//获取用户所有房间列表
//接口：/rooms/getrooms
//POST
export const _getrooms = ({account_user}) =>{
	return $http.request({
		url:'/rooms/getrooms',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			account_user
		}
	})
}

//获取实验室房间
//接口：/rooms/findById
//GET
export const _getRoomsNew = (ownerId) =>{
	return $http.request({
		url:'/rooms/findById?ownerId='+ownerId,
		method:'GET',
		header:{
			"Content-Type":"application/json"
		}
	})
}
//改变房间排序
//接口：/rooms/changeRoomOrder
//POST
export const _changeRoomOrder = ({data}) =>{
	return $http.request({
		url:'/rooms/changeRoomOrder',
		method:'POST',
		header:{
			"Content-Type":"application/json"
		},
		data:{
			data
		}
	})
}
